import request from '@/utils/request'

// 查询项目角色信息列表
export function listDealRole(query) {
  return request({
    url: '/deal/role/list',
    method: 'get',
    params: query
  })
}

// 查询项目角色信息详细
export function getDealRole(id) {
  return request({
    url: '/deal/role/' + id,
    method: 'get'
  })
}

// 保存项目角色信息
export function saveDealRole(data) {
  return request({
    url: '/deal/role/save',
    method: 'post',
    data: data
  })
}

// 保存项目角色信息
export function updateDealRole(data) {
  return request({
    url: '/deal/role',
    method: 'put',
    data: data
  })
}

// 根据角色ID查询菜单下拉树结构
export function roleDealMenuTreeselect(roleId, dealType) {
  return request({
    url: '/deal/role/roleMenuTreeselect/' + roleId + '/' + dealType,
    method: 'get'
  })
}

// 根据项目ID和类型获取权限
export function getPermission(dealId, dealType, menuKey) {
  return request({
    url: '/deal/role/permission/' + dealId + '/' + dealType + '/' + menuKey,
    method: 'get'
  })
}

// 保存项目角色信息
export function addDealRole(data) {
  return request({
    url: '/deal/role',
    method: 'post',
    data: data
  })
}

// 删除项目角色信息
export function delDealRole(id) {
  return request({
    url: '/deal/role/' + id,
    method: 'delete'
  })
}

// 删除项目角色信息
export function delDealRoles(ids) {
  return request({
    url: '/deal/role/delRole/' + ids,
    method: 'delete'
  })
}

// 导出项目角色信息
export function exportDealRole(query) {
  return request({
    url: '/deal/role/export',
    method: 'get',
    params: query
  })
}
